package com.nursebetty.server.resource;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import com.nursebetty.server.common.UserProfile;
import com.nursebetty.server.model.BloodPressure;
import com.nursebetty.server.model.Glucoss;
import com.nursebetty.server.model.WeightLost;
import com.nursebetty.server.service.BloodPressureService;
import com.nursebetty.server.service.GlucossService;
import com.nursebetty.server.service.WeightLostService;
import com.sun.jersey.spi.resource.Singleton;

@Path("/")
@Singleton
public class NurseBettyResource {
	private BloodPressureService bloodService;
	private GlucossService glucossService;
	private WeightLostService weightService;
	
	
	@GET @Path("/login")
	@Produces("application/xml")
	public boolean login(@QueryParam("name") String name, @QueryParam("p") String password){
		return true;
	}
	
	@GET @Path("/getWeight")
	@Produces("application/xml")
	public List<WeightLost> getWeight(@QueryParam("id") String userId){
		UserProfile up = new UserProfile();
		up.setId(userId);
		List<WeightLost> result = weightService.getResults(up);
		return result;
	}

	
	@GET @Path("/getBlood")
	@Produces("application/xml")
	public List<BloodPressure> getBlood(@QueryParam("id") String userId){
		UserProfile up = new UserProfile();
		up.setId(userId);
		List<BloodPressure> result = bloodService.getResults(up);
		return result;
	}
	
	@GET @Path("/getClucoss")
	@Produces("application/xml")
	public List<Glucoss> getGlucoss(@QueryParam("id") String userId){
		UserProfile up = new UserProfile();
		up.setId(userId);
		List<Glucoss> result = glucossService.getResults(up);
		return result;
	}

	public BloodPressureService getBloodService() {
		return bloodService;
	}

	public void setBloodService(BloodPressureService bloodService) {
		this.bloodService = bloodService;
	}

	public GlucossService getGlucossService() {
		return glucossService;
	}

	public void setGlucossService(GlucossService glucossService) {
		this.glucossService = glucossService;
	}

	public WeightLostService getWeightService() {
		return weightService;
	}

	public void setWeightService(WeightLostService weightService) {
		this.weightService = weightService;
	}
}
